{extend name="public:member" /}
{block name="content"}
<div id="member_content">
	<div class="allWrap">
		{include file="public:member_menu" /}
		<div id="right_content">
			<div id="member-nav" class="clearfix">
				<ul id="top-tag" class="order-list">
					<li class="fl {if condition="'' eq input('param.status')"} on {/if}" id="all_order">
						<div id="order_type">
							<p><a href="{:url('order_member/index')}">
								
								<?php $type=input('param.type'); ?>
								{if condition="$type"}								
									{:get_goods_type_info(array('type'=>$type),'type')}
								{else/}
								全部订单
								{/if}								
							
							</a></p>	
							<ul>
								<li><a href="{:url('order_member/index')}">全部订单</a></li>
								<li><a href="{:url('order_member/order_type',array('type'=>config('common_goods')))}">普通订单</a></li>								
								<li><a href="{:url('order_member/order_type',array('type'=>config('tuan_goods')))}">团购订单</a></li>
								<li><a href="{:url('order_member/order_type',array('type'=>config('points_goods')))}">积分兑换</a></li>
							</ul>	
						</div>			
					</li>
					<li class="fl {if condition="config('default_order_status_id') eq input('param.status')"} on {/if}">
						<a href="{:url('order_member/status',array('status'=>config('default_order_status_id')))}">待付款订单
							{if condition="$no_pay"}
							（<span class="red">{$no_pay}</span>）
							{/if}
						</a>
					</li>
					<li class="fl {if condition="config('shipping_order_status_id') eq input('param.status')"} on {/if}">
						<a href="{:url('order_member/status',array('status'=>config('shipping_order_status_id')))}">待确认收货
						{if condition="$no_get"}
							（<span class="red">{$no_get}</span>）
							{/if}
						</a>
					</li>
					<li class="fl {if condition="config('get_order_status_id') eq input('param.status')"} on {/if}">
						<a href="{:url('order_member/status',array('status'=>config('get_order_status_id')))}">待评价商品
						{if condition="$no_reply"}
							（<span class="red">{$no_reply}</span>）
							{/if}
						</a>
					</li>
					
				</ul>
				<form action="{:url('order_member/index')}" method="GET">								
					<input value="{:input('param.order_num')}" name="order_num" placeholder="输入订单编号" type="text">
					<input value="" type="submit">
			   	</form>
			</div>
			
			<div class="title">
				<i class="i1">订单商品</i>
				<i class="i2">收货人</i>
				<i class="i3">金额</i>
				<i class="i4">商品操作</i>
				<i class="i5">
						<div class="select" style="width:86px">
							<p>							
								<?php $status=input('param.status'); ?>
								{if condition="$status"}
								<?php echo get_order_status_name($status); ?>
								{else/}
								全部状态
								{/if}
							</p>
							<ul>
								<li value="1"><a href="{:url('order_member/index')}">全部状态</a></li>
								<li value="2"><a href="{:url('order_member/status',array('status'=>config('default_order_status_id')))}">等待付款</a></li>
								<li value="3"><a href="{:url('order_member/status',array('status'=>config('shipping_order_status_id')))}">等待收货</a></li>
								<li value="4"><a href="{:url('order_member/status',array('status'=>config('complete_order_status_id')))}">已完成</a></li>
								<li value="5"><a href="{:url('order_member/status',array('status'=>config('cancel_order_status_id')))}">已取消</a></li>
							</ul>
						</div>	
				</i>
				<i class="i6">交易操作</i>
			</div>
			{volist name="data" id="v" empty="$empty"}
			<div class="boxorder">
				<div class="number gray">
					订单编号：<a href='{:url("OrderMember/show_order",array("id"=>$hashids->encode($v["order"]["order_id"])))}' target="_blank" class="blue">{$v.order.order_num_alias}</a> 
					
					<span style="margin-right:30px;">
						{:get_goods_type_info(array('type'=>$v['order']['type']),'type')}	
					</span>
					
					下单时间：{$v.order.date_added|date="Y-m-d H:i:s",###}
				</div>
				<table>
					<tbody>
						<tr>
							<td class="t1">
								{volist name="v.list" id="g" empty="$empty"}
									<a class="img60" href="{:get_goods_type_info(array('type'=>$g['type'],'goods_id'=>$g['goods_id']),'url')}" target="_blank">
										<img src="IMG_ROOT{$g.image|resize=60,60}">
									</a>	
								{/volist}
							</td>
							<td class="t2">{$v.order.shipping_name}</td>
							<td class="t3">
								<i class="redprice oof">								
								{:get_goods_type_info(array('type'=>$v['order']['type'],'price'=>$v['order']['total']),'price')}
								</i>
							</td>
							<td class="t4">
								<?php if($v['order']['type']!=config('points_goods')&&$v['order']['order_status_id']==config('complete_order_status_id')&&(time()<($v['order']['date_modified']+86400*config('aftersales_time')))){?>
									<a href="{:url('aftersales/choice',array('id'=>$hashids->encode($g['order_id'])))}">申请售后</a>
								<?php } ?>
								
								<?php if($v['order']['type']!=config('points_goods')&&$v['order']['order_status_id']==config('shipping_order_status_id')){?>
									<a href="{:url('aftersales/choice',array('id'=>$hashids->encode($g['order_id'])))}">退款/退货</a>
								<?php } ?>
								
							</td>
							<td class="t5">
							
							<span class="green">{:get_order_status_name($v['order']['order_status_id'])}</span>
							
							<br><a href='{:url("OrderMember/show_order",array("id"=>$hashids->encode($g["order_id"])))}' target="_blank" class="gray">订单详情</a>
							
							</td>
							<td class="t6">
								{//未支付}
								{if condition="$v['order']['order_status_id'] eq config('default_order_status_id')"}
		                        	<a order_id="{$v.order.order_id}" id="pay{$v.order.order_id}" class="pointer re_pay buttonred">去支付</a>
									<a href="{:url('OrderMember/cancel',array('id'=>$hashids->encode($g['order_id'])))}" class="pointer delete">取消订单</a>	
								{//已经付款，待发货}
								{elseif condition="$v['order']['order_status_id'] eq config('paid_order_status_id')"/}
									{if condition="$v['order']['type'] eq config('points_goods')"}
										{//积分类商品不可退货}	
										等待发货	
									{else/}
										<a href="{:url('aftersales/choice',array('id'=>$hashids->encode($g['order_id'])))}" class="pointer buttonred">退款</a>
									{/if}						
								{//已发货，待收货}	
								{elseif condition="$v['order']['order_status_id'] eq config('shipping_order_status_id')"/}		
									<a class="gbutton delete" href="{:url('OrderMember/confirm',array('id'=>$hashids->encode($v['order']['order_id'])))}">确认收货</a>
								{//已收货，待评价}	
								{elseif condition="$v['order']['order_status_id'] eq config('get_order_status_id')"/}	
									<a href="{:url('comment/add',array('id'=>$hashids->encode($v['order']['order_id'])))}" class="gbutton">去评价</a>	
									<a class="blue">交易关闭</a>	
								{//已经取消}
								{elseif condition="$v['order']['order_status_id'] eq config('cancel_order_status_id')"/}	
									<a class="blue">交易关闭</a>
								{elseif condition="$v['order']['order_status_id'] eq config('complete_order_status_id')"/}
									已经评价<br/>	
									<a class="blue">再次购买</a>	
								{elseif condition="$v['order']['order_status_id'] eq config('refund_order_status_id')"/}
									<a class="blue">退款中</a>	
								{elseif condition="$v['order']['order_status_id'] eq config('close_order_status_id')"/}
									<a class="blue">交易关闭</a>	
								{/if}					
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			{/volist}
			
			<div class="page">{$list->render()}</div>
						
		</div>
	</div>
</div>
{/block}

{block name="javascript"}
<script>	
$(function(){
    
    $('.re_pay').click(function(){
		
		var order_id=$(this).attr('order_id');
		
		var url="{:url('Payment/Payment/choice_payment_type')}"+"/order_id/"+order_id;
		
		art.dialog.open(url, {
						title:'去付款',
						id:'apply',						
						lock: true
		});
	});
    
});
</script>
{/block}